<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Easy
  </div>
  <div>
   <h1 class="question_title">
    112. Path Sum
   </h1>
   <p>
    Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
   </p>
   <p>
    <strong>
     Note:
    </strong>
    &nbsp;A leaf is a node with no children.
   </p>
   <p>
    <strong>
     Example:
    </strong>
   </p>
   <p>
    Given the below binary tree and
    <code>
     sum = 22
    </code>
    ,
   </p>
   <pre>
      <strong>5</strong>
     <strong>/</strong> \
    <strong>4</strong>   8
   <strong>/</strong>   / \
  <strong>11</strong>  13  4
 /  <strong>\</strong>      \
7    <strong>2</strong>      1
</pre>
   <p>
    return true, as there exist a root-to-leaf path
    <code>
     5-&gt;4-&gt;11-&gt;2
    </code>
    which sum is 22.
   </p>
  </div>
  <div>
   <h1 class="question_title">
    112. 路径总和
   </h1>
   <p>
    给定一个二叉树和一个目标和，判断该树中是否存在根节点到叶子节点的路径，这条路径上所有节点值相加等于目标和。
   </p>
   <p>
    <strong>
     说明:
    </strong>
    &nbsp;叶子节点是指没有子节点的节点。
   </p>
   <p>
    <strong>
     示例:
    </strong>
    &nbsp;
    <br>
    给定如下二叉树，以及目标和
    <code>
     sum = 22
    </code>
    ，
   </p>
   <pre>              <strong>5</strong>
             / \
            <strong>4 </strong>  8
           /   / \
          <strong>11 </strong> 13  4
         /  \      \
        7    <strong>2</strong>      1
</pre>
   <p>
    返回
    <code>
     true
    </code>
    , 因为存在目标和为 22 的根节点到叶子节点的路径
    <code>
     5-&gt;4-&gt;11-&gt;2
    </code>
    。
   </p>
  </div>
 </body>
</html>